/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidade;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bruno
 */
@Entity
@Table(name = "areas_disponiveis")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AreasDisponiveis.findAll", query = "SELECT a FROM AreasDisponiveis a"),
    @NamedQuery(name = "AreasDisponiveis.findByIdAreasDisponiveis", query = "SELECT a FROM AreasDisponiveis a WHERE a.idAreasDisponiveis = :idAreasDisponiveis"),
    @NamedQuery(name = "AreasDisponiveis.findByDesignacao", query = "SELECT a FROM AreasDisponiveis a WHERE a.designacao = :designacao"),
    @NamedQuery(name = "AreasDisponiveis.findByNumeroVagas", query = "SELECT a FROM AreasDisponiveis a WHERE a.numeroVagas = :numeroVagas")})
public class AreasDisponiveis implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idAreasDisponiveis")
    private Integer idAreasDisponiveis;
    @Size(max = 45)
    @Column(name = "designacao")
    private String designacao;
    @Column(name = "numero_vagas")
    private Integer numeroVagas;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idAreasDisponiveis")
    private Collection<Candidatura> candidaturaCollection;

    public AreasDisponiveis() {
    }

    public AreasDisponiveis(Integer idAreasDisponiveis) {
        this.idAreasDisponiveis = idAreasDisponiveis;
    }

    public Integer getIdAreasDisponiveis() {
        return idAreasDisponiveis;
    }

    public void setIdAreasDisponiveis(Integer idAreasDisponiveis) {
        this.idAreasDisponiveis = idAreasDisponiveis;
    }

    public String getDesignacao() {
        return designacao;
    }

    public void setDesignacao(String designacao) {
        this.designacao = designacao;
    }

    public Integer getNumeroVagas() {
        return numeroVagas;
    }

    public void setNumeroVagas(Integer numeroVagas) {
        this.numeroVagas = numeroVagas;
    }

    @XmlTransient
    public Collection<Candidatura> getCandidaturaCollection() {
        return candidaturaCollection;
    }

    public void setCandidaturaCollection(Collection<Candidatura> candidaturaCollection) {
        this.candidaturaCollection = candidaturaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAreasDisponiveis != null ? idAreasDisponiveis.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AreasDisponiveis)) {
            return false;
        }
        AreasDisponiveis other = (AreasDisponiveis) object;
        if ((this.idAreasDisponiveis == null && other.idAreasDisponiveis != null) || (this.idAreasDisponiveis != null && !this.idAreasDisponiveis.equals(other.idAreasDisponiveis))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.AreasDisponiveis[ idAreasDisponiveis=" + idAreasDisponiveis + " ]";
    }
    
}
